# coding=utf-8
import io
import json
from catch_logging import CatchLogging


# 配置数据读取
class CatchConfig(object):
    __catch_config = None

    def __init__(self, base_url):
        catch_config = io.open('{}/catch_config.json'.format(base_url), 'r', encoding='utf-8')
        config_data = json.loads(catch_config.read())
        catch_config.close()
        self.__catch_config = config_data
        print('read config success: {}'.format(str(config_data)))
        CatchLogging.info('读取配置文件数据{}'.format(str(config_data)))

    def get_catch_config_data(self, key):
        return self.__catch_config[key]

    def get_catch_config(self):
        return self.__catch_config
